<template>
	<view>
		<view class="1">
			<uni-card>
				<view style="float: left;">
					<u-avatar src="/static/img/fximage/x.jpg"></u-avatar>
				</view>
				<view class="" style="width: 75%; font-size: 30rpx; float: left; margin-left: 20rpx;">
					<text>抄送申请</text>
				</view>
				<view class="2" style="width: 75%; float: left; margin-left: 20rpx; margin-top: 15rpx;
					margin-bottom: 20rpx;">
					审批状态：<span style="color: green;">审批完成等待抄送</span>
				</view>
			</uni-card>
			<view>
				<uni-card title="登记信息" v-for="(info,index) in approveList" :key="index">
					<view style="width: 100%;">
						姓名：{{info.ename}}
					</view>
					<view style="width: 100%;">
						手机号码：{{info.phone}}
					</view>
					<view style="width: 100%;">
						入职部门：{{info.department}}
					</view>
					<view style="width: 100%;">
						上级负责人：{{info.superior}}
					</view>
					<view style="width: 100%;">
						学历：{{info.education}}
					</view>
					<view style="width: 100%;">
						职位：{{info.position}}
					</view>
					<view style="width: 100%;">
						员工类型：{{info.staff}}
					</view>
					<view style="width: 100%;">
						合同公司：{{info.contract}}
					</view>
					<view style="width: 100%;">
						员工状态：{{info.usertype}}
					</view>
					<view style="width: 100%;">
						预计入职日期：{{aa(info.estimate)}}
					</view>
					<view style="width: 100%;">
						试用期：{{info.trial}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==4">
						离职日期：{{aa(info.quit)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==6">
						考勤补卡日期：{{aa(info.supplement)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==7">
						请假日期：{{aa(info.leave)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==7">
						请假时长：{{info.leavetime}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==8">
						加班日期：{{aa(info.overtime)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==8">
						加班时长：{{info.workovertime}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==9">
						出差日期：{{aa(info.travel)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==9">
						出差地点：{{info.traveladdress}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==9">
						返回时间{{aa(info.returntime)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==10">
						报销金额：{{info.reimbursement}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==10 || info.enclosure==11">
						付款时间：{{aa(info.paymenttime)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==11">
						付款金额：{{info.payment}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==12">
						合同取用时间：{{aa(info.access)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==12">
						用途：{{info.purpose}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==13">
						备用金取用时间：{{aa(info.apply)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==13">
						备用金取用金额：{{info.applypay}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==13">
						还款时间：{{aa(info.repayment)}}
					</view>
					<view style="width: 100%;" v-if="info.enclosure==13">
						转正时间：{{aa(info.intotime)}}
					</view>
					<view style="width: 100%;">
						提交时间：{{aa(info.createtime)}}
					</view>
				</uni-card>
			</view>
			<view>
				<uni-card title="审批流程">
					<!-- thumbnail="/static/img/fximage/x.jpg" -->
					<view style="width: 15%; float: left; margin-bottom: 15rpx;">
						<u-avatar src="/static/img/fximage/c.jpg"></u-avatar>
					</view>
					<view style="width: 80%; float: left;margin-top: 15rpx;">
						审批人：小红
					</view>
				</uni-card>
				<uni-card>
					<view style="width: 15%; float: left; margin-bottom: 15rpx;">
						<u-avatar src="/static/img/fximage/c.jpg"></u-avatar>
					</view>
					<view style="width: 80%; float: left;margin-top: 15rpx;">
						抄送人：小红
					</view>
				</uni-card>
				<!-- changesp(id) -->
				<view style="width: 80%; float: left; margin-left: 60rpx;margin-bottom:20rpx">
					<u-button type="primary" text="已完成抄送" @click="changesp(id)"></u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				spid: 3,
				id: '',
				approveList: [],
			}
		},
		onLoad(res) {
			this.id = res.id
			this.selectinfo()
		},
		methods: {
			aa(date) {
				const dateTime = new Date(date)
				const YY = dateTime.getFullYear()
				const MM =
					dateTime.getMonth() + 1 < 10 ? '0' + (dateTime.getMonth() + 1) : dateTime.getMonth() + 1
				const DD =
					dateTime.getDate() < 10 ? '0' + dateTime.getDate() : dateTime.getDate()
				const hh =
					dateTime.getHours() < 10 ? '0' + dateTime.getHours() : dateTime.getHours()
				const mm =
					dateTime.getMinutes() < 10 ? '0' + dateTime.getMinutes() : dateTime.getMinutes()
				const ss =
					dateTime.getSeconds() < 10 ? '0' + dateTime.getSeconds() : dateTime.getSeconds()
				return `${YY}-${MM}-${DD}`
			},
			selectinfo() {
				uni.request({
					url: 'http://localhost:9525/aduit/approve/selectById?id=' + this.id,
					// http://localhost:9525/aduit/approve/selectById?id=50
					method: 'GET',
					success: (res) => {
						this.approveList = res.data.data.list
					},
				});
			},
			changesp(id) {
				// debugger
				uni.request({
					url: 'http://localhost:9525/aduit/approve/updatesp?id=' + this.id + "&spid=" + 4,
					method: 'POST',
					success: (res) => {
						console.log("进来了")
						this.approveList = res.data.data.list
					},

				});
				this.tz();
				// uni.switchTab({
				// 	url:'./examine'
				// })
			},
			tz() {
				uni.navigateTo({
					url: './review'
				})
			},
			nochangesp(id) {
				uni.request({
					url: 'http://localhost:9525/aduit/approve/updatesp?id=' + this.id + "&spid=" + 2,
					method: 'POST',
					success: (res) => {
						console.log("进来了")
						this.approveList = res.data.data.list
					},
				});
				this.tz();
			},
		}
	}
</script>

<style>

</style>
